/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.jili.ubert.dao.db;

import java.io.Serializable;
import com.baidu.bjf.remoting.protobuf.Codec;
import com.baidu.bjf.remoting.protobuf.ProtobufProxy;
import com.baidu.bjf.remoting.protobuf.annotation.Protobuf;
import com.jili.ubert.code.CodeTool;
import java.io.IOException;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author dragon
 */
@Entity
@Table(name = "risk_index")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "RiskIndex.findAll", query = "SELECT r FROM RiskIndex r"),
    @NamedQuery(name = "RiskIndex.findByIndexCode", query = "SELECT r FROM RiskIndex r WHERE r.indexCode = :indexCode"),
    @NamedQuery(name = "RiskIndex.findByIndexName", query = "SELECT r FROM RiskIndex r WHERE r.indexName = :indexName"),
    @NamedQuery(name = "RiskIndex.findByTypeA", query = "SELECT r FROM RiskIndex r WHERE r.typeA = :typeA"),
    @NamedQuery(name = "RiskIndex.findByTypeB", query = "SELECT r FROM RiskIndex r WHERE r.typeB = :typeB"),
    @NamedQuery(name = "RiskIndex.findByTypeC", query = "SELECT r FROM RiskIndex r WHERE r.typeC = :typeC"),
    @NamedQuery(name = "RiskIndex.findByReMark", query = "SELECT r FROM RiskIndex r WHERE r.reMark = :reMark"),
    @NamedQuery(name = "RiskIndex.findByUnit", query = "SELECT r FROM RiskIndex r WHERE r.unit = :unit"),
    @NamedQuery(name = "RiskIndex.findByIsHaveThreshold", query = "SELECT r FROM RiskIndex r WHERE r.isHaveThreshold = :isHaveThreshold"),
    @NamedQuery(name = "RiskIndex.findByThresholdNum", query = "SELECT r FROM RiskIndex r WHERE r.thresholdNum = :thresholdNum"),
    @NamedQuery(name = "RiskIndex.findByThresholdSplitSig", query = "SELECT r FROM RiskIndex r WHERE r.thresholdSplitSig = :thresholdSplitSig"),
    @NamedQuery(name = "RiskIndex.findByAssetsScope", query = "SELECT r FROM RiskIndex r WHERE r.assetsScope = :assetsScope"),
    @NamedQuery(name = "RiskIndex.findByCanNumerator", query = "SELECT r FROM RiskIndex r WHERE r.canNumerator = :canNumerator"),
    @NamedQuery(name = "RiskIndex.findByCanDenominator", query = "SELECT r FROM RiskIndex r WHERE r.canDenominator = :canDenominator"),
    @NamedQuery(name = "RiskIndex.findByLevelType", query = "SELECT r FROM RiskIndex r WHERE r.levelType = :levelType"),
    @NamedQuery(name = "RiskIndex.findByIsRateOrAbs", query = "SELECT r FROM RiskIndex r WHERE r.isRateOrAbs = :isRateOrAbs"),
    @NamedQuery(name = "RiskIndex.findByIsForceDone", query = "SELECT r FROM RiskIndex r WHERE r.isForceDone = :isForceDone"),
    @NamedQuery(name = "RiskIndex.findBySceneType", query = "SELECT r FROM RiskIndex r WHERE r.sceneType = :sceneType"),
    @NamedQuery(name = "RiskIndex.findByOwnUserID", query = "SELECT r FROM RiskIndex r WHERE r.ownUserID = :ownUserID"),
    @NamedQuery(name = "RiskIndex.findByAlterUserID", query = "SELECT r FROM RiskIndex r WHERE r.alterUserID = :alterUserID"),
    @NamedQuery(name = "RiskIndex.findByCreateTime", query = "SELECT r FROM RiskIndex r WHERE r.createTime = :createTime"),
    @NamedQuery(name = "RiskIndex.findByTimeStamp", query = "SELECT r FROM RiskIndex r WHERE r.timeStamp = :timeStamp")})
public class RiskIndex implements Serializable {
	public static byte[] EnCode(RiskIndex msg) throws IOException {
		Codec<RiskIndex> Lcode = ProtobufProxy.create(RiskIndex.class);
		return Lcode.encode(msg);
	}
	public static RiskIndex DeCode(byte[] data) throws IOException {
	Codec<RiskIndex> Lcode = ProtobufProxy.create(RiskIndex.class);
		return Lcode.decode(data);
	}

    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "IndexCode")
    @Protobuf
	private String indexCode;
    @Column(name = "IndexName")
    private String indexName;
	@Protobuf
	private byte[] indexNameBit;
    @Column(name = "TypeA")
    @Protobuf
	private String typeA;
    @Column(name = "TypeB")
    @Protobuf
	private String typeB;
    @Column(name = "TypeC")
    @Protobuf
	private String typeC;
    @Column(name = "ReMark")
    private String reMark;
	@Protobuf
	private byte[] reMarkBit;
    @Column(name = "Unit")
    @Protobuf
	private String unit;
    @Column(name = "IsHaveThreshold")
    @Protobuf
	private String isHaveThreshold;
    @Column(name = "ThresholdNum")
    @Protobuf
	private Short thresholdNum;
    @Column(name = "ThresholdSplitSig")
    @Protobuf
	private String thresholdSplitSig;
    @Column(name = "AssetsScope")
    @Protobuf
	private String assetsScope;
    @Column(name = "CanNumerator")
    @Protobuf
	private String canNumerator;
    @Column(name = "CanDenominator")
    @Protobuf
	private String canDenominator;
    @Column(name = "LevelType")
    @Protobuf
	private String levelType;
    @Column(name = "IsRateOrAbs")
    @Protobuf
	private String isRateOrAbs;
    @Column(name = "IsForceDone")
    @Protobuf
	private String isForceDone;
    @Column(name = "SceneType")
    @Protobuf
	private String sceneType;
    @Lob
    @Column(name = "CaseShow")
    @Protobuf
	private String caseShow;
    @Column(name = "OwnUserID")
    @Protobuf
	private String ownUserID;
    @Column(name = "AlterUserID")
    @Protobuf
	private String alterUserID;
    @Column(name = "CreateTime")
    @Temporal(TemporalType.TIMESTAMP)
    private Date createTime;
	//@Protobuf
//tprivate long createTimeL;
    @Column(name = "TimeStamp")
    @Temporal(TemporalType.TIMESTAMP)
    private Date timeStamp;
	//@Protobuf
	//private long timeStampL;

    public RiskIndex() {
    }

    public RiskIndex(String indexCode) {
        this.indexCode = indexCode;
    }

    public String getIndexCode() {
        return indexCode;
    }

    public void setIndexCode(String indexCode) {
        this.indexCode = indexCode;
    }

    public String getIndexName() {
        return indexName;
    }

    public void setIndexName(String indexName) {
        this.indexName = indexName;
        this.setIndexNameBit(CodeTool.StringToBit(indexName));
    }

    public String getTypeA() {
        return typeA;
    }

    public void setTypeA(String typeA) {
        this.typeA = typeA;
    }

    public String getTypeB() {
        return typeB;
    }

    public void setTypeB(String typeB) {
        this.typeB = typeB;
    }

    public String getTypeC() {
        return typeC;
    }

    public void setTypeC(String typeC) {
        this.typeC = typeC;
    }

    public String getReMark() {
        return reMark;
    }

    public void setReMark(String reMark) {
        this.reMark = reMark;
		this.setReMarkBit(CodeTool.StringToBit(reMark));
    }

    public String getUnit() {
        return unit;
    }

    public void setUnit(String unit) {
        this.unit = unit;
    }

    public String getIsHaveThreshold() {
        return isHaveThreshold;
    }

    public void setIsHaveThreshold(String isHaveThreshold) {
        this.isHaveThreshold = isHaveThreshold;
    }

    public Short getThresholdNum() {
        return thresholdNum;
    }

    public void setThresholdNum(Short thresholdNum) {
        this.thresholdNum = thresholdNum;
    }

    public String getThresholdSplitSig() {
        return thresholdSplitSig;
    }

    public void setThresholdSplitSig(String thresholdSplitSig) {
        this.thresholdSplitSig = thresholdSplitSig;
    }

    public String getAssetsScope() {
        return assetsScope;
    }

    public void setAssetsScope(String assetsScope) {
        this.assetsScope = assetsScope;
    }

    public String getCanNumerator() {
        return canNumerator;
    }

    public void setCanNumerator(String canNumerator) {
        this.canNumerator = canNumerator;
    }

    public String getCanDenominator() {
        return canDenominator;
    }

    public void setCanDenominator(String canDenominator) {
        this.canDenominator = canDenominator;
    }

    public String getLevelType() {
        return levelType;
    }

    public void setLevelType(String levelType) {
        this.levelType = levelType;
    }

    public String getIsRateOrAbs() {
        return isRateOrAbs;
    }

    public void setIsRateOrAbs(String isRateOrAbs) {
        this.isRateOrAbs = isRateOrAbs;
    }

    public String getIsForceDone() {
        return isForceDone;
    }

    public void setIsForceDone(String isForceDone) {
        this.isForceDone = isForceDone;
    }

    public String getSceneType() {
        return sceneType;
    }

    public void setSceneType(String sceneType) {
        this.sceneType = sceneType;
    }

    public String getCaseShow() {
        return caseShow;
    }

    public void setCaseShow(String caseShow) {
        this.caseShow = caseShow;
    }

    public String getOwnUserID() {
        return ownUserID;
    }

    public void setOwnUserID(String ownUserID) {
        this.ownUserID = ownUserID;
    }

    public String getAlterUserID() {
        return alterUserID;
    }

    public void setAlterUserID(String alterUserID) {
        this.alterUserID = alterUserID;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
		//this.createTimeL = CodeTool.DateToLong(createTime);
    }

    public Date getTimeStamp() {
        return timeStamp;
    }

    public void setTimeStamp(Date timeStamp) {
        this.timeStamp = timeStamp;
		//this.timeStampL = CodeTool.DateToLong(timeStamp);
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (indexCode != null ? indexCode.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof RiskIndex)) {
            return false;
        }
        RiskIndex other = (RiskIndex) object;
        if ((this.indexCode == null && other.indexCode != null) || (this.indexCode != null && !this.indexCode.equals(other.indexCode))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.jili.ubert.dao.db.RiskIndex[ indexCode=" + indexCode + " ]";
    }

    public byte[] getIndexNameBit() {
        return indexNameBit;
    }

    public void setIndexNameBit(byte[] indexNameBit) {
        this.indexNameBit = indexNameBit;
		this.indexName = CodeTool.BitToString(indexNameBit);
    }

    public byte[] getReMarkBit() {
        return reMarkBit;
    }

    public void setReMarkBit(byte[] reMarkBit) {
        this.reMarkBit = reMarkBit;
		this.reMark = CodeTool.BitToString(reMarkBit);
    }
    
}
